{__NOLAYOUT__}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <link href="__STATIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="__STATIC__/jquery-3.3.1.min.js"></script>
    <script src="__STATIC__/jquery.form.min.js"></script>
    <script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>
    <link href="__STATIC__/style.css" rel="stylesheet">
    <script src="__STATIC__/layer/layer.js"></script>
</head>
<div class="container">
    <div class="row">
        <form id="rule-form" class="mt10" method="post" action="addRule" enctype="multipart/form-data">
            <div class="col-sm-6 ">
                <div class="form-group">
                    <label>ID</label>
                    <input type="text" name="PAGE_ID" class="form-control">
                </div>
            </div>
            <div class="col-sm-6 ">
                <div class="form-group">
                    <label>父级</label>
                    <select name="GROUP_ID" class="form-control">
                        <option value="0" >无</option>
                        {volist name="parentRuleList" id="vo"}
                        <option value="{$vo.PAGE_ID}" >{$vo.PAGE_NAME}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="col-sm-6 ">
                <div class="form-group">
                    <label>标题</label>
                    <input type="text" name="PAGE_NAME" class="form-control">
                </div>
            </div>
            <div class="col-sm-6 ">
                <div class="form-group">
                    <label>地址</label>
                    <input type="text" name="PAGE_URL" class="form-control">
                </div>
            </div>
            <div class="col-sm-6 ">
                <div class="form-group">
                    <label>是否基础</label>
                    <select name="IS_BASE" class="form-control">
                        <option value="1">是</option>
                        <option value="0">否</option>
                    </select>
                </div>
            </div>

            <div class="col-sm-12" style="margin-top: 10px;margin-bottom: 20px;text-align: center">
                <button id="add-button" type="button" class="btn btn-info">新增</button>
                <button type="reset" class="btn btn-default">重置</button>
            </div>
        </form>
    </div>
</div>

<script>

    $(function () {

        $("#add-button").on('click',function () {

            layer.confirm('确认新增权限信息吗？',function (index) {
                layer.close(index);

                $("#rule-form").ajaxSubmit(function (text) {
                    console.log(text);
                    var json = JSON.parse(text);
                    if(json['code'] == '200'){
                        layer.alert(json['msg'],{icon:1},function () {
                            console.log('success');
                            layer.closeAll();
                        })
                    }
                    else{
                        layer.alert(json['msg'],{icon:2},function (index) {
                            layer.close(index);
                        })
                    }
                });
            })


        })
    })

</script>